﻿#pragma once

#include <combaseapi.h>
#include "check_result.h"

/**
 * 控制COM初始化和反初始化的RAII类型
 */
struct com_init
{
    com_init()
    {
        HRESULT result = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
        check_result(result, L"CoInitializeEx");
    }

    ~com_init()
    {
        CoUninitialize();
    }
};
